$(function(){
	/*点击关注按钮，提交数据到concerns.php进行后台处理*/
	$(".friend_details .friend_accept").click(function(){
		/*先取得所要关注人的昵称*/
		var clickArea = $(this);
		var c_name = $(this).parent().prevAll("a").text();
		$.ajax(
				{
					type: "POST",
					url: "php_ajax/concerns.php",
					dataType: "html",
					cache: false,
					data: {name: c_name},
					success: function(data) {
						if (!data){
							return;
						}
						else {
							clickArea.find("a").unbind("hover").css("color","#000000");
							clickArea.css("background-color","#ccc");
							alert("您已关注此人");
							refreshConcerns();
						}
					}
				}
		);
	});
	
	/*刷新页面*/
	function refreshConcerns(){
		/*刷新关注人数*/
		$.ajax({
			type: "POST",
			url: "php_ajax/load_concerns_num.php",
			cache: false,
			success: function(data){
				data = "关注" + data;
				$("#concernsNum_button a").empty().html(data);
			}
		});
		
		/*刷新微博*/
		$.ajax({
			type: "POST",
			url: "php_ajax/load_weibo.php",
			dataTpe: "html",
			cache: false,
			success: function(data){
				var weibo_content = "";
				$("#weibo_box").empty().html(data);
			}
		});
	}
});